package cn.com.shbs.Service.UserInfoService;

import cn.com.shbs.Dao.UserInfoDao.UserInfoDao;
import cn.com.shbs.model.LoginUser;
import cn.com.shbs.model.UserInfo.UserInfo;

import java.util.HashMap;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserInfoServiceImpl implements IUserInfoService{
    static Logger logger = LoggerFactory.getLogger(UserInfoServiceImpl.class);
    @Autowired
    public UserInfoDao userInfoDao;

    /**通过登录名称查询用户信息**/
    @Override
    public UserInfo findByLoginname(String loginname) throws Exception{
        return userInfoDao.findByLoginname(loginname);
    }

    @Override
    public void Modfiysysuser(LoginUser userInfo) throws Exception {

        logger.info("UserInfoServiceImpl.Modfiysysuser() 方法 start");

        try{
            //添加用户信息
            userInfoDao.addUserInfo(userInfo);
        }catch (Exception e){
            logger.error("UserInfoServiceImpl.Modfiysysuser()",e);
            throw  e;
        }

        logger.info("UserInfoServiceImpl.Modfiysysuser() 方法 end");

    }

	@Override
	public List<UserInfo> FindUserInfoByStoreId(HashMap map) throws Exception {
		// TODO Auto-generated method stub
		
		
        List<UserInfo> loginUser_list=null;
	
	try {

		loginUser_list=userInfoDao.FindUserInfoByStoreId(map);
		

	} catch (Exception e) {
		logger.error("LoginUserServiceImp.FindShopByName()", e);
		throw e;
	}

	logger.info("LoginUserServiceImp.FindShopByName() 方法 end");
	
	
	return loginUser_list;
	}

	@Override
	public int FindUserInfoByStoreIdNums(String store_code) throws Exception {
		// TODO Auto-generated method stub
		
		int nums=0;
		
		try {

			nums=userInfoDao.FindUserInfoByStoreIdNums(store_code);

		} catch (Exception e) {
			logger.error("LoginUserServiceImp.FindUserInfoByStoreIdNums()", e);
			throw e;
		}

		logger.info("LoginUserServiceImp.FindUserInfoByStoreIdNums() 方法 end");
		
		
		return nums;
	}

	
}
